#ifndef __CHUNK__
#define __CHUNK__

#include "Block.h"

#include <cstdint>

class Chunk
{
public:
	Block	Blocks[16 * 256 * 16];
	byte	Data[16 * 256 * 16];

	Chunk()
	{
		memset(&Blocks, 0, sizeof(Blocks));
		memset(&Data, 0, sizeof(Data));
	}

	inline Block &GetBlock(const Point3b &pt)
	{
		return Blocks[(pt.Z << 8 << 4) + (pt.Y << 4) + pt.X];
	}

	inline byte &GetData(const Point3b &pt)
	{
		return Data[(pt.Z << 8 << 4) + (pt.Y << 4) + pt.X];
	}
	
	inline bool IsFull(const Point3b &pt)
	{
		return (GetData(pt) & 0x01) != 0;
	}

	inline bool IsOpaque(const Point3b &pt)
	{
		return (GetData(pt) & 0x02) != 0;
	}
};
#endif